package org.Lin.util;

import java.io.*;
import java.sql.*;
import java.util.Properties;

public class DatabaseUtil {
    private static Connection connection;

    public static Connection getConnection() throws SQLException {
        if (connection == null || connection.isClosed()) {
//            Properties props = new Properties();
//            try (InputStream input = new FileInputStream("dbo.properties")) {
//                props.load(input);
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//
//            String url = props.getProperty("db.url");
//            String username = props.getProperty("db.username");
//            String password = props.getProperty("db.password");

        String url = "jdbc:mysql://localhost:3306/chat_db";
        String username = "chat_db";
        String password = "me049057";

            connection = DriverManager.getConnection(url, username, password);
        }
        return connection;
    }
}